<?php

namespace App\Http\Controllers\Admin\Superadmin;

use Illuminate\Http\Request;
use Hash;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class ConfigController extends Controller
{	
	



	public function  getIndex()
	{	
		
		return view('admin.superadmin.config.index');
	}



		//上传图片
        public function Upload(Request $request,$pic){            

            //检测是否有文件上传
            if($request->hasFile($pic)){
               

                //随机文件名
                $name = md5(time()+rand(1,9999));

                //获取后缀名
                $su = $request->file($pic)->getClientOriginalExtension();
                $arr = array('jpg','png','jpeg');

                //判断
                if(!in_array($su,$arr)){

                    echo '<script type="text/javascript">alert("上传文件不合法");location.href="http://zcool.cn/picture/add";</script>';
                }

                //将文件移动到指定目录下
                $request->file($pic)->move('./uploads/',$name.'.'.$su);

				//返回去骗路径
                return '/uploads/'.$name.'.'.$su;
            }
				//默认图片
                return '/uploads/default.jpg';
        }
	

}	
